package com.baidu;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;

public class Server {
	public static void main(String args[]){
		try {
			DatagramSocket serverSocket = new DatagramSocket(1234);
			byte[] buf = new byte[256];
			DatagramPacket packet = new DatagramPacket(buf,buf.length);
			String text;
			while(true){
				try {
					serverSocket.receive(packet);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				text = new String(packet.getData(),0,packet.getLength());
				System.out.print(packet.getAddress().getHostAddress()+";"
						+packet.getPort()+"---"+text);
				if(text.startsWith("88")){
					break;
				}
			}	
		} catch (SocketException e) {			
			e.printStackTrace();
		}
	}
}
